1. Field of the Invention
The present invention relates to a circuit for detecting irregularities in a clock signal in electronic microprocessor devices.
The present invention applies in particular but not exclusively to a microcontroller device comprising a microcontroller, non-volatile memories (ROM, EPROM, EEPROM or FLASH EEPROM) and volatile memories (RAM) as well as input and output communication gates (I/O) and the following description is given with reference to this field of application only for the purpose of simplifying discussion thereof.
2. Description of the Prior Art
At present microcontrollers are commonly used in devices requiring an intelligent electronic control which is simple and flow in cost. For example they are used in the automobile field, automatic controls for industrial machine tools, safety devices, or in the new generation of electrical household appliances.
To reach the high degree of reliability required in these devices there is a trend towards equipping the microcontrollers with circuits designed to prevent or correct malfunctions in the devices or in the peripheral circuits connected thereto. These malfunctions can occur during normal use of the microcontroller or following wrong use thereof, e.g. when the correct timings for the signals applied at its inputs are not respected.
A typical circuit of this type inserted in many microcontrollers of the new generation is a circuit known to those skilled in the art as a "watchdog timer". This circuit was conceived to meet either hardware or software problems which can occur during operation of devices equipped with a microprocessor, and its use was subsequently extended to the field of microcontrollers.
The operating principle of said circuit is quite simple. The heart of the circuit is a counter whose internal register is incremented at a frequency equal to the clock signal of the microcontroller or a submultiple of said frequency. When the contents of the register reach the highest value, the circuit generates a hardware reset signal which reinitialises the microcontroller. By means of a special software instruction it is possible for a program to periodically zero the contents of the internal register of the counter. The program executed by the microcontroller calls for periodic zeroing to ensure correct operation of the entire system.
Contrariwise, if there occurs either a software or a hardware irregularity and normal program flow is interrupted, the register is no longer zeroed and the reset signal indicating malfunctioning reaches the microcontroller and reinitialises the system.
Generally the reset signal, which is generated in the microcontroller by the circuit just described, is also transferred to the exterior through a special terminal present in the microcontroller. It is thus possible to also hold the peripheral circuits interfaced with the microcontroller in reset state.
Although advantageous in some ways, this solution exhibits a serious shortcoming described below. If, following a failure in the circuit generating the clock signal, said signal is interrupted, even the watchdog circuit counter is in turn stopped, preventing correct operation of the latter circuit.
The microcontroller without the clock signal stops in a random unpredictable state. There can thus occur irregular situations in the microcontroller and also in the circuits interfaced therewith through the input and output communication gates (I/O).
The technical problem underlying the present invention is to provide a circuit capable of detecting irregularities in the clock signal, having structural and functional characteristics increasing the level of reliability of the microcontroller in which it is integrated, and overcoming the limitations and shortcomings indicated above with reference to the prior art.